package com.lagou.edu.service.impl;

import com.lagou.edu.Test.SendMail;
import com.lagou.edu.dao.LagouAuthCodeDao;
import com.lagou.edu.pojo.LagouAuthCode;
import com.lagou.edu.service.LagouAutoCodeService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * @Author wyx
 * @Date 2020/5/5 23:48
 */
@Service
public class LagouAuthCodeServiceImpl implements LagouAutoCodeService {

    @Autowired
    LagouAuthCodeDao lagouAuthCodeDao;

    @Override
    public void addLagouAuthCode(LagouAuthCode lagouAuthCode) throws Exception {

        SendMail.DoSendMail(lagouAuthCode.getEmail(),lagouAuthCode.getCode());
        lagouAuthCodeDao.save(lagouAuthCode);
    }

    @Override
    public List<LagouAuthCode> findAuthCodeByEmail(String email) {

        return lagouAuthCodeDao.findAuthCodeByEmail(email);

    }


}
